package hb.software.exam.category;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import edu.zut.hb.software.base.domain.BaseTreeEntity;
import hb.software.exam.entity.Exam;

@Entity
@Table(name="T_ExamCategory")
@NamedQueries({ @NamedQuery(name = "ExamCategory.getRoot", query = "select g from ExamCategory g where g.parent is null") })
public class ExamCategory extends BaseTreeEntity<ExamCategory, Long>{
	/**
	 *
	 */
	private static final long serialVersionUID = 8764640679365354777L;
	@Column
	String code;
	@Column
	String name;
	@OneToMany(mappedBy = "examCategory", cascade = CascadeType.REMOVE, fetch = FetchType.EAGER)
	List<Exam> exams;
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}

	public List<Exam> getExams() {
		return exams;
	}

	public void setExams(List<Exam> exams) {
		this.exams = exams;
	}
}
